var express = require('express');
var router = express.Router();
var Post = require('../models/posts.js');

router.post('/',function(req,res,next){
    var pageRequest = req.body;
    console.log(pageRequest);
    Post.getPage(pageRequest,function(err,posts){
        if(err){
            res.json({"success":false,message:'获取文章失败',posts:[]});
        }else{
            res.json({"success":true,message:'获取文章成功',posts:posts});
        }
    })
});

module.exports = router;